home *** CD-ROM | disk | FTP | other *** search
- /*
- File: MouseModule.h
-
- Contains: Header file for mouse module
-
- Version: xxx put version here xxx
-
- Copyright: © 1997-1999 by Apple Computer, Inc., all rights reserved.
-
- */
- #ifndef __MouseModuleH__
- #define __MouseModuleH__
-
- #include <Types.h>
- #include <Devices.h>
- #include <DriverServices.h>
- #include <Processes.h>
- #include <CursorDevices.h>
- #include <USB.h>
-
- #if UNIVERSAL_INTERFACES_VERSION <= 0x0330
- // the following were not defined in UI&L 3.3 nor in USB.h 1.4 and will generate compiler
- // errors
- enum {
- kUSBPortDisabled = -6969
- };
- #endif
-
- #define kMouseModuleName "\pUSBHIDMouseModule"
-
- Boolean immediateError(OSStatus err);
- void InitParamBlock(USBReference theInterfaceRef, USBPB * paramblock);
- void MouseInitiateTransaction(USBPB *pb);
- void MouseCompletionProc(USBPB *pb);
- void WatchDogCompletionProc(USBPB *pb);
- void InterfaceEntry(UInt32 interfacenum, USBInterfaceDescriptorPtr pInterfaceDescriptor, USBDeviceDescriptorPtr pDeviceDescriptor, USBDeviceRef device);
- void ChainJADBProc(void);
- void UnchainJADBProc(void);
-
- static OSStatus MouseDeviceInitialize(USBDeviceRef device, USBDeviceDescriptorPtr pDesc, UInt32 busPowerAvailable);
- static OSStatus MouseInterfaceInitialize(UInt32 interfacenum, USBInterfaceDescriptorPtr pInterface, USBDeviceDescriptorPtr pDesc, USBDeviceRef device);
- static OSStatus MouseModuleFinalize(USBDeviceRef theDeviceRef, USBDeviceDescriptorPtr pDesc);
-
- OSStatus USBHIDControlDevice(UInt32 theControlSelector, void * theControlData);
- void NotifyRegisteredHIDUser(UInt32 refcon, UInt32 reportSize, void * theReport, USBReference theInterfaceRef);
-
- void USBMouseIn(UInt32 refcon, void * theData);
-
- #define kMouseRetryCount 3
-
- enum driverstages
- {
- kUndefined = 0,
- kSetProtocol,
- kSetIdleRequest,
- kConfigureInterface,
- kSetRemoteWakeup,
- kFindPipe,
- kReadInterruptPipe,
- kGetPortStatus,
- kResetMouse,
- kResetMouseDelay,
- kPortStatusDelay,
- kReturnFromDriver = 0x1000,
- kRetryTransaction = 0x2000,
- kCompletionInProgess = 0x4000,
- kCompletionPending = 0x8000,
- kStageMask = 0x00ff
- };
-
- enum watchdogstates
- {
- kDelay10Seconds = 1,
- kCheckForAbort
- };
-
- typedef struct
- {
- USBPB pb;
- void (*handler)(USBPB *pb);
-
- Boolean intPipeAborted;
- Boolean driverRemovalPending;
-
- Boolean watchDogActivityFlag;
- Boolean watchDogAbortFlag;
- UInt32 watchDogState;
-
- USBReference interfaceRef;
- USBPipeRef pipeRef;
-
- USBDeviceDescriptor deviceDescriptor;
- USBInterfaceDescriptor interfaceDescriptor;
-
- UInt32 hidDeviceType;
- UInt8 hidReport[64];
- UInt32 maxPacketSize;
-
- HIDInterruptProcPtr pSHIMInterruptRoutine;
- HIDInterruptProcPtr pSavedInterruptRoutine;
-
- UInt32 interruptRefcon;
-
- HIDNotificationProcPtr pNotificationRoutine;
- UInt32 notificationRefcon;
-
- SInt32 retryCount;
- SInt32 transDepth;
-
- CursorDevicePtr pCursorDeviceInfo;
- CursorDevice cursorDeviceInfo;
- Fixed unitsPerInch;
-
- UInt32 previousState; // For port status check resume
- } usbMousePBStruct;
-
- #endif //__MouseModuleH__